package com.lufei.dh.view.Mult.Adapter.Lam;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.lufei.dh.R;
import com.lufei.dh.view.Mult.Bean.Song;

import me.drakeet.multitype.ItemViewBinder;

/**
 * 版权：易金卡沃 版权所有
 * <p>
 * 作者：lufei
 * <p>
 * 创建日期：2018/6/29
 * <p>
 * 描述：
 * <p>
 * 修订历史：
 */
public class CategoryViewBinder2 extends ItemViewBinder<Song, CategoryViewBinder2.ViewHolder> {
Context context;

    public CategoryViewBinder2(Context context) {
        this.context = context;
    }

    @NonNull
    @Override
    protected ViewHolder onCreateViewHolder(@NonNull LayoutInflater layoutInflater, @NonNull ViewGroup viewGroup) {
        View root = layoutInflater.inflate(R.layout.item_category, viewGroup, false);
        return new ViewHolder(root);
    }

    @Override
    protected void onBindViewHolder(@NonNull ViewHolder viewHolder, @NonNull Song category) {
        viewHolder.title.setText(category.getTitle());
        viewHolder.time.setText(category.getDate());
        Glide.with(context).load(category.getThumbnail_pic_s()).into(viewHolder.imageView1);
    }

    static class ViewHolder extends RecyclerView.ViewHolder {

        private TextView title;
        private ImageView imageView1;
        private TextView time;

        public ViewHolder(View itemView) {
            super(itemView);
            title = itemView.findViewById(R.id.title);
            time = itemView.findViewById(R.id.time);
            imageView1 = itemView.findViewById(R.id.image1);
        }
    }
}
